﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aj.Core;
using Aj.Core.Control;
using System.Data;

public partial class news_list : PageBase
{
    protected string w;
    protected DataSet ds = null;
    PageStructure ps = new PageStructure() { PageSize = 15, CurrPage = 1 };
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        try
        {
            w = QueryParam("w");
            ps.CurrPage = QueryParamInt32("page", 1);
            if (w.IsNotNullAndEmpty())
            {
                if (Utility.ProcessSqlStr(w))
                {
                    ds = CustomQuery.Article_GetArticlesByPage(" and A_Title like '%" + w + "%' and A_Cateid = " + Utility.NewsCid, ref ps);
                }
            }
            else
            {
                ds = CustomQuery.Article_GetArticlesByPage(" and A_Cateid = " + Utility.NewsCid, ref ps);
            }
            pager1.PageStruct = ps;
            if (w.IsNotNullAndEmpty())
            {
                pager1.TargetUrlFormat = "news-list.html?w=" + w + "&page={thispage}";
            }
            else
            {
                pager1.TargetUrlFormat = "news-list.html?page={thispage}";
            }
        }
        catch (Exception ex)
        {
            Utility.WriteErrorLog("news_list", ex);
        }
    }
}